#include<stdio.h>
#include"game.h"

//开始界面
void began()
{
	printf("**********************************\n");
	printf("*                                *\n");
	printf("*  输入任意非0数字+回车开始游戏  *\n");
	printf("*       输入0+回车退出游戏       *\n");
	printf("*                                *\n");
	printf("**********************************\n");
}

//游戏运行函数
void game()
{
	char block[WIDE][HIGH];
	int player = -1,x,y,t;
	deblock(block);
	prblock(block);
	do
	{
		player *= -1; t = 0;
	    if (player == 1) printf("请一号玩家落子(格式：先排后列，空格隔开,输入结束请点击回车)\n");
		if (player == -1) printf("请二号玩家落子(格式：先排后列，空格隔开，输入结束请点击回车)\n");
		scanf("%d %d", &x, &y);
		t=putgame(block,player,x,y);
		if (t == -1)
		{
			player *= -1;
			continue;
		}
		prblock(block);
	} while (overgame(block));
}

int main()
{
	int changer;
    do
	{
		began();//开始程序
		scanf("%d", &changer);
		if (changer == 0) return 0;
		else game();
		getchar();
	} while (changer);
	return 0;
}